package org.dreamwork.modbus.rtu.protocol;

import org.dreamwork.modbus.protocol.ModbusADU;

public class RtuADU extends ModbusADU {
    /** RTU 对端主机地址 */
    public byte address;

    @Override
    public byte[] toByteArray () {
        byte[] body = pdu.toByteArray ();
        byte[] buff = new byte[1 + body.length];    // 头部固定一字节地址
        buff[0] = address;
        System.arraycopy (body, 0, buff, 1, body.length);
        return buff;
    }
}
